<%--
  Created by IntelliJ IDEA.
  User: XBB
  Date: 2021/2/25
  Time: 17:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html style="height: 100%">
<head>
    <title>Title</title>
</head>
<body style="height: 100%; margin: 0">
<br>
<input type="text" placeholder="请输入年份"id="year">
<input type="button" value="查询" style="background-color: #93D1FF" onclick="btn()">
<div id="container" style="height: 100%"></div>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/echarts.js"></script>
<script type="text/javascript">
    var dom = document.getElementById("container");
    var myChart = echarts.init(dom);
    var year;
    var app = {};
    var option;
    function btn(){
        year=$("#year").val();
            $.post("${pageContext.request.contextPath}/stat/yearSoleJson",{"year":year},function (r) {
                option = {
                    xAxis: {
                        type: 'category',
                        data:['刘明太','宋人头','徐耗子尾之','虎大鬼头']
                    },
                    yAxis: {
                        type: 'value'
                    },
                    series: [{
                        data: r.data,
                        type: 'bar'
                    }]
                };

                if (option && typeof option === 'object') {
                    myChart.setOption(option);
                }
            })

    }

</script>
</body>
</html>
